1. Technical Field
The present disclosure relates to an apparatus for recognizing a pulse signal, and more particularly, to an apparatus for recognizing a pulse signal, which maintains the pulse signal being input for a scan time until an end time of the scan time, and thus stores the pulse signal as pulse input data at a pulse signal storage area.
2. Description of the Related Art
A programmable logic controller (PLC) device is a programmable logic device and typically serves as a computer. It receives a signal from equipment and processes the signal according to programmed contexts inside the PLC device, thereby outputting a processed signal to the equipment.
More particularly, the PLC device executes a scan program, which is programmed by a user, one time from start to finish and performs an operation processing on the execution result of the scan program. Here, a procedure in which the PLC device executes the scan program one time and performs the operation processing on the execution result of the scan program refers to a scan. That is, the PLC device repetitively performs a one time execution procedure for a scan time.
Generally, the PLC device performs a batch process on an input signal input from equipment and an output signal output thereto at a time in which a scan time is terminated. Therefore, there is a problem in that the PLC device does not recognize a pulse signal which is input for a short time in the middle of the scan time.
To address such a problem, a conventional PLC device is provided with an interrupt port at an internal micro process unit (MPU), and connects a pulse signal input circuit to the interrupt port to generate an interrupt signal when a pulse signal is input, thereby recognizing the pulse signal.
FIG. 1 is a circuit diagram of a conventional PLC device provided with a pulse signal input circuit.
Referring to FIG. 1, a plurality of interrupt ports A1, . . . , and An are provided at an MPU A, and a plurality of input terminals B1, . . . , and Bn, to which pulse signals are input, and the plurality of interrupt ports A1, . . . , and An are respectively connected to each other through a plurality of pulse signal input circuits C1, . . . , and Cn in a non-conducting state.
The plurality of pulse signal input circuits C1, . . . , and Cn respectively include optical couplers C1-1, . . . , and Cn−1, each of which maintains a non-conducting state and then is conducting when a signal is input, thereby outputting the input signal.
The plurality of pulse signal input circuits C1, . . . , and Cn convert pulse signals, which are input to the plurality of input terminals B1, . . . , and Bn, into a complementary metal-oxide semiconductor (CMOS) level to output the converted pulse signals to the plurality of interrupt ports A1, . . . , and An.
FIG. 2 is a flow chart illustrating a procedure in which the PLC device provided with a pulse signal input circuit recognizes a pulse signal, and FIG. 3 is a timing diagram between a pulse signal being input for a scan time and pulse input data stored at a pulse signal storage area.
Referring to FIGS. 2 and 3, before repetitively performing a scan, an MPU of the PLC device firstly initializes inputs/outputs and a memory in Operation S1. Thereafter, the MPU executes a scan program from a first stage to an nth stage, thereby completing one time scan in Operation S2. At this point, when a pulse signal P1 is input to an interrupt port in the middle of a scan time in which a scan program is executed, the MPU suspends the scan program and temporarily stores an input state of the pulse signal P1 in a buffer in Operation S2-1.
Afterward, the MPU returns to the scan program to continuously execute the scan program at the suspended point in Operation S2. When a pulse signal P2 is input again to the interrupt port before the Nth stage of the scan program is completed, the MPU suspends the scan program and temporarily stores an input state of the pulse signal P2 in the buffer in Operation S2-2.
After temporarily storing the input state of the pulse signal P2 in the buffer, the MPU returns to the scan program and then completes execution up to the Nthe stage of the scan program in Operation S2.
While completing the execution of the scan program from the first stage to the Nth stage, the MPU stores the input states of the pulse signals P1 and P2, which are stored in the buffer as inputs of the pulse signals P1 and P2, in a pulse signal storage area as pulse input data in Operation S3.
Lastly, the MPU completes one time scan by initializing the input states of the pulse signals P1 and P2, which are stored in the buffer, in Operation S4, and then returns to Operation S1, which is described above, to repetitively perform the scan. At this point, the pulse input data, which is stored in the pulse signal storage area, is maintained for a next scan time and is updated to the scan program.
As described above, when a pulse signal is input for a scan time, the conventional PLC device suspends a scan program, which is currently executed, performs a procedure of storing an input state of the input pulse signal in a buffer, and then returns to the scan program to resume the execution of the scan program.
Consequently, the conventional PLC device performs a procedure of storing an input state of a pulse signal in a buffer whenever the pulse signal is input so that there is a problem in that a scan time for performing a scan is inevitably increased as an input of the pulse signal is increased.
Also, the conventional PLC device should be provided with an interrupt port, which is configured to generate an interrupt signal when a pulse signal is input, at the MPU having a limited dimension so that there is a problem in that the number of input contact points of pulse signals is limited.